package cn.shutdown.demo.jvm;

/**
 * -Xss指定栈空间
 * 函数调用会创建栈帧，占用一定的栈空间，当请求深度大于最大的可用栈深度时，
 * 就会抛出 StackOverFlowError 异常
 * 执行本函数时分别增加-Xss128k 、 -Xss256k 看看效果
 * @author jiangwujie
 * @date 2021/5/6
 */
public class TestStackDeep {
    public static int count = 0;

    public static void recurison() {
        count++;
        recurison();
    }

    public static void recurison(long a, long b, long c) {
        long d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10;
        count++;
        recurison(a, b, c);
    }

    public static void main(String[] args) {
        try {
            recurison(0L, 0L, 0L);
        } catch (Throwable e) {
            System.out.println("deep of calling " + count);
        }
    }
}
